class slurm::install inherits slurm {
case $facts['os']['release']['major'] {
  '7':{
    yumrepo{"slurm":
      baseurl   => "http://202.122.33.67/yum/slurm/${facts['os']['release']['major']}/23.02.6",
      descr     => "slurm",
      enabled   => 1,
      gpgcheck  => 0,
      priority  => 20,
      before    => Yumrepo['site']
    }
  }
  /8|9/:{
    yumrepo{"slurm":
      baseurl   => "http://202.122.33.67/yum/slurm/${facts['os']['release']['major']}/23.11.6",
      descr     => "slurm",
      enabled   => 1,
      gpgcheck  => 0,
      priority  => 20,
      before    => Yumrepo['site']
    }
  }
}

  case $facts['os']['release']['major'] {
  '6': {
       $slurm_pkg = [
         "slurm",
         "slurm-devel",
         "slurm-munge",
         "slurm-openlava",
         "slurm-pam_slurm",
         "slurm-perlapi",
         "slurm-plugins",
         "slurm-seff",
         "slurm-sjobexit",
         "slurm-sjstat",
         "slurm-slurmdbd",
         "slurm-slurmdb-direct",
         "slurm-sql",
       ]
    }
  '7':{
      $slurm_pkg = [
        "slurm-slurmdbd-23.02.6-1.el7.x86_64",
        "slurm-slurmd-23.02.6-1.el7.x86_64",
        "slurm-slurmctld-23.02.6-1.el7.x86_64",
        "slurm-slurmrestd-23.02.6-1.el7.x86_64",
        "slurm-pam_slurm-23.02.6-1.el7.x86_64",
        "slurm-perlapi-23.02.6-1.el7.x86_64",
        "slurm-openlava-23.02.6-1.el7.x86_64",
        "slurm-libpmi-23.02.6-1.el7.x86_64",
        "slurm-devel-23.02.6-1.el7.x86_64",
        "slurm-contribs-23.02.6-1.el7.x86_64",
        "slurm-23.02.6-1.el7.x86_64",
      ]
    }
  '9':{
      $slurm_pkg = [
        "slurm-slurmdbd-23.11.6-1.el9.x86_64",
        "slurm-slurmd-23.11.6-1.el9.x86_64",
        "slurm-slurmctld-23.11.6-1.el9.x86_64",
        "slurm-slurmrestd-23.11.6-1.el9.x86_64",
        "slurm-pam_slurm-23.11.6-1.el9.x86_64",
        "slurm-perlapi-23.11.6-1.el9.x86_64",
        "slurm-openlava-23.11.6-1.el9.x86_64",
        "slurm-libpmi-23.11.6-1.el9.x86_64",
        "slurm-devel-23.11.6-1.el9.x86_64",
        "slurm-contribs-23.11.6-1.el9.x86_64",
        "slurm-23.11.6-1.el9.x86_64",
      ]
    }
  }

  $munge_pkg = [
    "munge",
    "munge-devel",
    "munge-libs",
  ]
  package{ $slurm_pkg:
    ensure   => 'installed',
    require  => Yumrepo['site']
  }
  package{ $munge_pkg:
    ensure   => 'installed',
    require  => Yumrepo['site']
  }
}
